Virtual machine technology has progressed significantly over the last several years, largely due to the success of the Java™ programming language, and more recently the C# language. The dynamic nature of these languages has spurred particular interest in the area of dynamic compilation and adaptive optimization. Most of the production Java Virtual Machines available today contain advanced adaptive optimization systems that monitor and optimize the program as it executes, and these systems have had a substantial impact on performance. These systems have used profiling information in multiple ways to improve performance. First, the frequently executed parts of the program were identified to determine where optimization efforts should be focused. Second, profiling was used to perform online, i.e. while the program is executing, feedback-directed optimizations. Some adaptive optimization systems have used profiling information during execution to improve the quality of generated code, giving them the potential to outperform a static compilation model. Conventional virtual machines normally discard a program's profile data at the end of execution.
Additionally, traditional off-line profiling has assumed a clear distinction between training runs, where profile data is collected, and production runs, where profile data is exploited. A virtual machine does not have the luxury of this distinction; every run is both a production run and a training run, thus a virtual machine must be prepared to adapt to continuously changing profile data.
Another problem is that systems that have performed optimization based on off-line profile data required a manual training step, which circumvents the automation of an automatic virtual machine. This manual training step drastically reduces the chance that such a technique will be used by a typical developer. For example, profile training data is used to optimize an application while the application is not running. Developers have to manually optimize and tweak the application for a set of known conditions. After the application has been optimized using the profile training data, the program is then conventionally executed as described above. Additionally, these systems assume a clear distinction between training and production runs and therefore cannot efficiently adapt to continuously changing profile data.
Because the program is optimized during training only for a given set of training conditions, when these conditions change in an execution environment, the program executes less than optimal. Another manual training optimization has to be performed to further optimize the program. Additionally, these training systems assume a clear distinction between training and production runs and therefore cannot efficiently adapt to continuously changing profile data.
Other systems have annotated Java byte-code to identify hot priority methods that should be optimized immediately at higher optimization levels. In addition to requiring a training step, this work does not generalize to programs that have a wide range of inputs. Their technique specifies that methods are always optimized at a fixed optimization level. For example, if a program has two inputs, one short running, and one long running their fixed strategy would perform poorly, either over-compiling for the short running programs, or under-compiling in the long-running ones.
Additional systems have performed ahead-of-time compilation, or static compilation of Java, where compilation is performed prior to program execution, to try and avoid the overhead caused by performing compilation at runtime. This approach has a number of disadvantages; first, it changes the execution model, introducing security concerns by eliminating the process of byte code verification. Modifying the compiled code on the disk circumvents all of Java's safety guarantees. Second, static compilation involves a number of technical challenges for language with features such as dynamic class loading and reflection. Finally, static compilation requires compiling and installing the application thereby preventing the technology from being used in many real world situations where automation is key.
Therefore a need exists to overcome the problems with the prior art as discussed above.